<?php
include("../../inc/global.inc");
$url="index.php";
$thepage=$_GET['page']?$_GET['page']:1;
$maxpage=20;
//$a = mysql_query('delete from m_message where member_id<0');
//echo mysql_affected_rows($conn);exit;
?>
<?php
if($_GET['del_act']){
$urls=$_SERVER['HTTP_REFERER'];
mysql_query("delete from m_message  where id='".$_GET['del_id']."'");
echo "<script>alert('删除成功');location='$urls';</script>";
}
if($_POST['submit33']){
$urls=$_SERVER['HTTP_REFERER'];
$a = $_POST['m_web'] ? " and m_web = '".$_POST['m_web']."'" : '';
$where = " member_id <1 $a";
mysql_query("delete from m_message  where $where");
echo "<script>alert('删除成功');location='$urls';</script>";
}
?>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<link rel="stylesheet" type="text/css" href="../css/css.css" />
<title>Admin</title>
<script type='text/javascript' src="../js/islogin.js" charset="gb2312"></script>
</head>
<body>
<center>
  <table width="95%" border="0" cellpadding="0" cellspacing="1" bgcolor="#000000">
    <tr>
      <td height="25" bgcolor="#EEEEF9" style="padding-left:5px;">询价邮件&nbsp;&nbsp;<a href="javascript:history.go(-1)">返回</a></td>
    </tr>
  </table>
  <table width="95%" border="0" cellpadding="0" cellspacing="1" bgcolor="#000000">
      <tr>
    <form method="get" action="" name="form1">
        <td width="34%" height="25" bgcolor="#EEEEF9" style="padding:5px;line-height:25px;">
          是否已查看<input type="checkbox" name="is_read" value="1" <?php if($_GET[is_read]==1){echo "checked";}?>>
          <input name="submit" type="submit" value="搜索"> 
	    </td>
    </form>
		    <form method="post" action="" name="form122">
        <td width="66%" bgcolor="#EEEEF9" style="padding:5px;line-height:25px;">
         <span style="display:none">删除网址: <input type="text" name="m_web" value="<?php echo $_POST['m_web'];?>" size="35"></span>
          <input name="submit33" type="submit" value="删除注册机发布信息"> 
		</td>
		  </form>
      </tr>
  </table>
  <table width="95%" border="0" cellpadding="0" cellspacing="1" bgcolor="#000000"> 
	<tr align='center'>
	<td width="6%" height="30" bgcolor="#8DA8CF">编号</td>
	<td width="14%" bgcolor="#8DA8CF">账号</td>
	<td width="10%" bgcolor="#8DA8CF">短信接口</td>
	<td width="35%" bgcolor="#8DA8CF">产品标题</td>
	<td width="20%" bgcolor="#8DA8CF">时间</td>
	<td width="7%" bgcolor="#8DA8CF">查看</td>
	<td width="13%" bgcolor="#8DA8CF">管理操作</td>
	</tr>
<?php
if($_GET[is_read]){
$sqls=$sqls2=" where is_read='$_GET[is_read]'";
}

$sql="select m_message.id,m_message.member_id,m_message.m_subject,m_message.add_time,m_message.is_read,m_message.m_web from m_message ".$sqls." order by id desc limit ".($thepage-1)*$maxpage.",$maxpage";
//echo $sql;
$rs=mysql_query($sql);
$i=1;
while($row=mysql_fetch_array($rs)){
$color=($i%2)?"#FFFFFF":"#eeeeee";
if($row['member_id'])
{
	$query = mysql_query('select m_user from member where id ='.$row['member_id']);
	$row2 = mysql_fetch_array($query);
}
?>
<tr align='center' bgcolor=<?=$color?>>
<td height="25" align="center"><?=$i?></td>
<td align="center"><?=$row2['m_user']?>(<?=$row['member_id']?>)</td>
<td align="center"><a href="ms.php?m_phone=<?=$row['m_phone']?>" target="_blank">发手机短信</a></td>
<td align="center"><a href="<?=$row['m_web']?>"  target="_blank"><?=mb_substr($row[m_subject],0,18,'utf-8')?>--连接</a></td>
<td align="center"><?=$row['add_time']?></td>
<td align="center"><?php if($row[is_read]==1){?>
  <font color="blue">是</font>
  <?php }else{?>
  <font color="#FF0000">否</font>
  <?php }?></td>
<td><a href="index_modify.php?xg=ok&xg_id=<?=$row['id']?>&xg_page=<?=$thepage?>">查看</a>&nbsp;|&nbsp;<a href="index.php?del_act=ok&del_id=<?=$row['id']?>" onClick="return del()">删除</a></td>
</tr>
<?php
$i++;
}?>
<?php
$totalrecord=mysql_num_rows(mysql_query("select * from m_message ".$sqls2));
$totalpage=ceil($totalrecord/$maxpage);
?>
  <tr>
     <td height="31" colspan="10" align="center" bgcolor="#FFFFFF"><form method="get" action="<?=$url?>?is_read=<?=$_GET[is_read]?>">
<?php if($thepage>1){?>
   <a href="<?=$url?>?is_read=<?=$_GET[is_read]?>">第一页</a>&nbsp;<a href="<?=$url?>?page=<?=$thepage-1?>&is_read=<?=$_GET[is_read]?>">上一页</a>&nbsp;
<?php }?>  
<?php if($thepage!=$totalpage){?>
   <a href="<?=$url?>?page=<?=$thepage+1?>&is_read=<?=$_GET[is_read]?>">下一页</a>&nbsp;<a href="<?=$url?>?page=<?=$totalpage?>&is_read=<?=$_GET[is_read]?>">最后一页</a>&nbsp;
<?php }?>   
   【共<font color="red"><?=$totalrecord?></font>条记录】【每页<font color="red"><?=$maxpage?></font>条记录】【共<font color="red"><?=$totalpage?></font>页】<input type="text" name="page" size="3" onKeyUp="IsDigit(this);">&nbsp;<input type="submit" value="GO"></form></td>
  </tr>
</table>
</center>
</BODY>
</HTML>

<script language="javascript">
function IsDigit(obj) 
{ 
if(obj.value.replace(/[\d+]/ig,"").length>0) { 
  alert('请输入数字'); 
  document.getElementById(obj).value =""; 
} 
} 
</script>